//
//  ReadingDetailCell.m
//  SunXi
//
//  Created by dllo on 15/11/26.
//  Copyright © 2015年 大远. All rights reserved.
//

#import "ReadingDetailCell.h"


@implementation ReadingDetailCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}


- (void)create{
    
    self.view = [[UIView alloc] init];
    [self addSubview:self.view];
    
    self.labelTitle = [[UILabel alloc] init];
    [self addSubview:self.labelTitle];
    self.labelTitle.font = [UIFont systemFontOfSize:18 weight:12];
    
    self.labelDetail = [[UIImageView alloc] init];
    [self addSubview:self.labelDetail];
    
    self.image = [[UILabel alloc] init];
    [self addSubview:self.image];
    self.image.numberOfLines = 0;
    self.image.font = [UIFont systemFontOfSize:15];
    self.image.textColor = [UIColor grayColor];
//    self.view.layer.borderWidth = 1;
//    self.labelTitle.layer.borderWidth = 1;
//    self.labelDetail.layer.borderWidth = 1;
//    self.image.layer.borderWidth = 1;
}



- (void)layoutSubviews{
   
    [self.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.and.left.and.bottom.and.right.equalTo(self).insets(UIEdgeInsetsMake(HT / 100 * 5, WH / 100, HT / 100 * 5, WH / 100));
    }];
    
    [self.labelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).with.offset(0);
        make.left.equalTo(self.view).with.offset(0);
        make.bottom.equalTo(self.labelDetail.mas_top).with.offset(0);
        make.right.equalTo(self.view).with.offset(0);
        make.width.equalTo(@(150));
        make.height.equalTo(@(50));
    }];
    
    [self.labelDetail mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.labelTitle.mas_bottom).with.offset(0);
        make.left.equalTo(self.view).with.offset(0);
        make.bottom.equalTo(self.labelDetail).with.offset(0);
        make.right.equalTo(self.image.mas_left).with.offset(-20);
        make.width.equalTo(@(150));
        make.height.equalTo(@(80));
    }];
    
    [self.image mas_makeConstraints:^(MASConstraintMaker *make) {
    
        make.left.equalTo(self.labelDetail.mas_right).with.offset(20);
        make.top.equalTo(self.view).with.offset(50);
        make.bottom.equalTo(self.view).with.offset(- 15);
        make.right.equalTo(self.view).with.offset(- 20);
        
    }];
//    self.image.backgroundColor = [UIColor yellowColor];
    self.view.backgroundColor = [UIColor whiteColor];
}



//- (void)setModel:(ReadingDetailModel *)model{
//    
//    if (_model != model) {
//        self.labelTitle.text = model.title;
//        self.image.text = model.content;
//        [self.labelDetail sd_setImageWithURL:[NSURL URLWithString:model.coverimg]];
//    }
//    
//}


@end









